package ysq.xyg.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import ysq.xyg.dao.DeviceDao;
import ysq.xyg.model.BaseDepart;
import ysq.xyg.model.Device;
import ysq.xyg.service.DeviceService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yu sheng qiang
 * @create 2017-04-19 14:11
 **/
@Service("deviceService")
public class DeviceServiceImpl extends BaseServiceImpl<Device> implements DeviceService {
    @Resource
    private DeviceDao deviceDao;
    @Autowired
    public void setDeviceDao(DeviceDao deviceDao) {
        this.baseDao = deviceDao;
    }
    //条件查询
    public List<Device> list(Device device) {

        Example example = new Example(Device.class);
        Example.Criteria criteria = example.createCriteria();
        if(device!=null){
            if(StringUtil.isNotEmpty(device.getDeviceId())){
                criteria.andEqualTo("deviceId",device.getDeviceId());
            }
        }
        List<Device> list=deviceDao.selectByExample(example);
        return list;
    }

}
